package com.dxq.test.db;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;

/**
 * Author: zsh
 * Date: 2023/10/17
 * Describe: 牲畜事件表（字段）
 */
@DatabaseTable(tableName = "Event")
public class Event implements Serializable {

    public final static String ID_FIELD_NAME = "event_id";

    // id = true:表明这个字段是这条记录的唯一标志符, generatedId = true:表明自动增加的ID
    //序号
    @DatabaseField(generatedId = true, columnName = ID_FIELD_NAME)
    private int event_id;

    //事件名称
    @DatabaseField(columnName = "name")
    private String name;

    //事件内容
    @DatabaseField(columnName = "info")
    private String info;

    //事件时间
    @DatabaseField(columnName = "time")
    private String time;

    //所属牧场  牧场--外键
    @DatabaseField(columnName = "pasture_id", foreign = true, foreignAutoRefresh = true, foreignAutoCreate = true)
    private Pasture pasture_id;//序号

    public Event() {
    }

    public Event(String name, String info, String time, Pasture pasture_id) {
        this.name = name;
        this.info = info;
        this.time = time;
        this.pasture_id = pasture_id;
    }

    public int getEvent_id() {
        return event_id;
    }

    public void setEvent_id(int event_id) {
        this.event_id = event_id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public String toString() {
        return "Event{" +
                "event_id=" + event_id +
                ", name='" + name + '\'' +
                ", info='" + info + '\'' +
                ", time='" + time +
                ", pasture_id='" + pasture_id +
                '}';
    }
}
